package com.film.admincontroller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.film.domain.FilmShowings;
import com.film.service.ShowingsService;
import com.film.service.impl.ShowingsServiceImpl;
@WebServlet("/filmShowingsPage.do")
public class FilmShowingsPageController extends HttpServlet{
	private ShowingsService showingsService = new ShowingsServiceImpl();
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		String page = request.getParameter("page");
		
		System.out.println(page);
		HttpSession session = request.getSession();
		//查询所有的排期信息
		List<FilmShowings> filmShowing = showingsService.selectAllShowings(0);
		List<FilmShowings> filmShowings = showingsService.limitShowings(Integer.parseInt(page));
		session.setAttribute("filmShowings", filmShowings);
		session.setAttribute("showingTemp", filmShowing);
		response.sendRedirect("admin_jsp/filmShowings.jsp?flag="+page);
	}
}
